﻿Imports System.Data.OleDb

Public Class Register
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RegisterUser.ContinueDestinationPageUrl = Request.QueryString("ReturnUrl")
    End Sub

    Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles RegisterUser.CreatedUser
        FormsAuthentication.SetAuthCookie(RegisterUser.UserName, False)

        Dim conn = New OleDbConnection(ConfigurationManager.ConnectionStrings("ChineseFoodConn").ConnectionString)
        Dim sql = "INSERT INTO Profiles (TravellerName) VALUES (@f1)"
        Dim cmd = New OleDbCommand(sql, conn)
        cmd.Parameters.AddWithValue("@f1", RegisterUser.UserName)
        conn.Open()
        cmd.ExecuteNonQuery()

        Response.Redirect("~/editProfile.aspx")

    End Sub
End Class